package com.sm.scorpio.ui.fragment.mine;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;

/**
 * created by zhud on 2019/7/12
 */
public class MineMenuItemBean implements Parcelable {
    @DrawableRes
    public int image_id;
    @StringRes
    public int string_id;
    public String remark;

    //是否显示右键按钮
    public boolean isShowRight;

    //上面的线
    public boolean isShowTopLine = false;
    //上面的分割空间
    public boolean isShowTopDivision = false;

    public MineMenuItemBean(@DrawableRes int image_id, @StringRes int string_id) {
        this.image_id = image_id;
        this.string_id = string_id;
    }

    public MineMenuItemBean(@DrawableRes int image_id, @StringRes int string_id, String remark) {
        this.image_id = image_id;
        this.string_id = string_id;
        this.remark = remark;
    }

    protected MineMenuItemBean(Parcel in) {
        image_id = in.readInt();
        string_id = in.readInt();
        remark = in.readString();
        isShowRight = in.readByte() != 0;
        isShowTopLine = in.readByte() != 0;
        isShowTopDivision = in.readByte() != 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(image_id);
        dest.writeInt(string_id);
        dest.writeString(remark);
        dest.writeByte((byte) (isShowRight ? 1 : 0));
        dest.writeByte((byte) (isShowTopLine ? 1 : 0));
        dest.writeByte((byte) (isShowTopDivision ? 1 : 0));
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<MineMenuItemBean> CREATOR = new Creator<MineMenuItemBean>() {
        @Override
        public MineMenuItemBean createFromParcel(Parcel in) {
            return new MineMenuItemBean(in);
        }

        @Override
        public MineMenuItemBean[] newArray(int size) {
            return new MineMenuItemBean[size];
        }
    };

    public MineMenuItemBean setShowTopLine(boolean showTopLine) {
        isShowTopLine = showTopLine;
        return this;
    }

    public MineMenuItemBean setShowTopDivision(boolean showTopDivision) {
        isShowTopDivision = showTopDivision;
        return this;
    }

    public MineMenuItemBean setShowRight(boolean showRight) {
        isShowRight = showRight;
        return this;
    }
}
